package com.wc.AlgoOJ_homework.aloj练习赛.E_公式构造;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/5/8 21:41
 * @description hhttp://43.138.190.70:8888/p/GDCPC8
 */
public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static char[] s;

    public static void main(String[] args) {
        char[] s = (sc.next()).toCharArray();
        int n = s.length - 1;
        long res = 0;
        for (int i = 0; i < 1 << n; i++) {
            int pre = 0;
            for (int j = 0; j < n; j++) {
                if ((i >> j & 1) == 1) {
                    long sum = 0;
                    for (int k = pre; k <= j; k++) {
                        sum = sum * 10 + s[k] - '0';
                    }
                    res += sum;
                    pre = j + 1;
                }
            }
            long sum = 0;
            for (int j = pre; j <= n; j++) {
                sum = sum * 10 + s[j] - '0';
            }
            res += sum;
        }
        out.println(res);
        out.flush();
    }
}

